<template>
  <div>
    <section>
      <img class="full-width" src="/static/bg11.png" alt="">
    </section>
    <section class="section-2 relative">
      <p class="header mt60">TECHNOLOGICAL<span>科技成果评价</span></p>
      <div class="rules-item">
        <!-- <div class="mod flex-space-between"  @click="toDetail1()">
          <div class="mod-left">
            <span class="circel"></span>
            <span class="title">申报系统</span>
          </div>
        </div> -->
        <div class="mod flex-space-between" v-for="(item, index) in menu" :key="index" @click="toDetail(item)">
          <div class="mod-left">
            <span class="circel"></span>
            <span class="title">{{item.name}}</span>
          </div>
          <!-- <div class="mod-right">
            <a  @click.stop="down(item.realPath)" class="down">下载</a>
            <span class="time">{{item.time}}</span>
          </div> -->
        </div>
      </div>
      <!-- <a-pagination class="xh-pager" :pageSize="pageSize" @change="changePage" v-model="current" :total="total" show-less-items /> -->
    </section>
  </div>
</template>
<script>
import { tracker } from 'lib/analytics'
export default {
  name: 'association',
  data () {
    return {
      list: [],
      menu: [{
        name: '文件通知',
        type: 6,
        id: 1000300
      }, {
        name: '申报系统',
        type: 1,
        id: 2
      }, {
        name: '管理制度',
        type: 5,
        id: 1000301
      }, {
        name: '成果推广',
        type: 7,
        id: 1000302
      }],
      current: 1,
      total: 0,
      pageSize: 10
    }
  },
  components: {
  },
  computed: {
  },
  created () {
    // this.getArticles()
  },
  methods: {
    getArticles () {
      this.$http.getArticles({}, 'KJCG', this.current, this.pageSize).then(res => {
        res.data.list.forEach(v => {
          v.realPath = `${process.env.VUE_APP_SRC}${v.realPath}`
        })
        this.total = res.data.total
        this.list = res.data.list
      })
    },
    changePage (page, size) {
      this.current = page
      this.getArticles()
    },
    toDetail (item) {
      if (!item.type) {
        this.$router.push({ path: `/fold/${item.id}` })
      } else if (item.type == 1) {
        this.menu = [{
          name: '评价须知',
          type: 3,
          id: 1
        }, {
          name: '填写申请',
          type: 4,
          id: 1
        }, {
          name: '申报列表',
          type: 2,
          id: 4
        }]
      } else if (item.type == 2) {
        this.$http.validToken({}).then(res => {
          if (!res.data) {
            this.$router.push({ path: '/login', query: { back: window.location.href } })
          } else {
            this.$router.push({ path: `/innovation/supplier/list` })
          }
        })
      } else if (item.type == 3) {
        this.$router.push({ path: `/innovation/supplier/notice` })
      } else if (item.type == 4) {
        if (!tracker.getRoles() || !tracker.getRoles().includes("4")) {
          this.$router.push({ path: '/login', query: { back: window.location.href, role: 4 } })
          return false
        }
        this.$http.validToken({}).then(res => {
          if (!res.data) {
            this.$router.push({ path: '/login', query: { back: window.location.href, role: 4 } })
          } else {
            this.$router.push({ path: `/innovation/supplier/1` })
          }
        })
      } else if (item.type == 6) {
        this.$router.push({ path: `/innovation/pdf`, query: { url: 'CYPY_CJCGPJ_WJTZ' } })
      } else if (item.type == 5) {
        this.$router.push({ path: `/innovation/pdf`, query: { url: 'CYPY_CJCGPJ_GLZD' } })
      } else if (item.type == 7) {
        this.$router.push({ path: `/innovation/pdf`, query: { url: 'CYPY_CJCGPJ_CGTG' } })
      }
    },
    toDetail1 () {
      this.$router.push({ path: `/innovation/supplier/notice` })
    },
    down (url) {
      if (url) {
        window.location.href = url
      }
    }
  }
}
</script>
<style lang="scss">
</style>
